The present invention generally relates to memory management, and more particularly to using multiple heap data banks with reserved areas within the data banks.
The number of concurrent activities that can be started and the number of files that can be opened by an application program are limited by some data processing systems because of the manner in which memory space is managed by the system. Some data processing systems allocate a heap memory bank of a certain size to an application. The heap bank is available for file input/output (I/O) and for use by activities started by the application. In one environment, for example, the USC C environment from Unisys, an activity is an executing part of a program and is sometimes referred to as a xe2x80x9ctask.xe2x80x9d The tasks or activities of a program generally execute concurrently. When the available space in the heap bank is exhausted, no additional files can be opened and no additional activities can be started by the application. Thus, in order to open a new file or start another activity, the application would need to wait for a file to be closed or an activity to complete. This limits the flexibility in developing applications.
One approach to dealing with the limited bank size is to increase the size of the heap bank for an application. However, the size of the heap bank may present addressing problems for some applications. For example, some systems, such as the Unisys 2200 series data processing systems, support applications with different addressing modes: xe2x80x9cbasic modexe2x80x9d is an 18-bit addressing architecture and xe2x80x9cextended modexe2x80x9d is a 36-bit addressing architecture. If the size of a heap bank is increased beyond the limits of basic mode addressing, basic mode middleware would need to be modified to accommodate the increased address space, thereby incurring additional and perhaps unnecessary development expense.
A method and apparatus that addresses the aforementioned problems, as well as other related problems, are therefore desirable.
The invention provides a method and apparatus for managing heap memory for an application program in a data processing system. The system supports a basic addressing mode and an extended addressing mode. Programs operating in the basic addressing mode are limited to addressing using a first number of bits, program operating in the extended addressing mode are limited to addressing using a second number of bits, and the first number of bits is less than the second number of bits. One or more heap banks are established for an application program, with each heap bank having a quantity of memory space that is addressable by the program operating in basic addressing mode. The heap banks are managed by a system program operating in extended addressing mode. In response to each request from the application program that requires a quantity of memory space, one of the heap banks is selected for allocating the memory. An additional heap bank is established if none of the heap banks has a quantity of available memory space that satisfies the required quantity.